import pandas as pd

df = pd.DataFrame({
    "语文": [77, 59, 46],
    "数学": [70, 88, 49],
    "英语": [79, 90, 32]
}, index=["a1", "a2", "a3"])

print("原始DataFrame:\n", df)

df_melted = pd.melt(df.reset_index(), var_name='科目', value_name='成绩')
print("使用pd.melt转换后的DataFrame:\n", df_melted)